<script lang="jsx" setup>
import { ref } from 'vue';
import { Empty } from 'ant-design-vue';
import { getEngineeringDataInquiry } from '@/service/api/modules/engineering-manage/engineering-data-inquiry';
const simpleImage = Empty.PRESENTED_IMAGE_SIMPLE;

const imgSrc = ref(null);

const isLocalHost = window.location.hostname === 'localhost';

function getData(params) {
  getEngineeringDataInquiry(params).then(({ data, error }) => {
    if (!error) {
      console.log(data);
      if (data.image) {
        imgSrc.value = `${isLocalHost ? 'http://192.168.166.166/dev-api/' : '/dev-api/'}${data.image}`;
      } else {
        imgSrc.value = null;
      }
    }
  });
}

defineExpose({
  getData
});
</script>

<template>
  <!--
 <Table
    ref="tableRef"
    v-model:searchParams="searchParams"
    class="h-full"
    :column="column"
    :show-row-selection="false"
    row-key="id"
    :scroll="{ y: 'auto' }"
    :is-init-get-data="false"
    url="/rcerp/erpMiFile/getLaminationByProdNo"
    :auto-generate-uuid="true"
    :is-pagination="false"
  >
    <template #title>工程图纸</template>
  </Table>
-->
  <div class="h-full w-full flex-center">
    <template v-if="imgSrc">
      <!-- <img :src="imgSrc" alt="" /> -->
      <AImage :src="imgSrc" />
    </template>
    <template v-else>
      <AEmpty :image="simpleImage" description="暂无工程图纸" />
    </template>
  </div>
</template>

<style lang="scss" scoped></style>
